<?php

use yii\helpers\Html;
use yii\helpers\Url;
use kartik\grid\GridView;

/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var yiike\credit\models\search\CreditSearch $searchModel
 */
$this->title                   = '用户余额';
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="giiant-crud credit-index">

    <?php //      echo $this->render('_search', ['model' =>$searchModel]);   ?>


    <?php \yii\widgets\Pjax::begin(['id' => 'pjax-main', 'enableReplaceState' => false, 'linkSelector' => '#pjax-main ul.pagination a, th a', 'clientOptions' => ['pjax:success' => 'function(){alert("yo")}']]) ?>

    <div class="box box-info">
        <div class="box-header with-border">
            <h3 class="box-title"><?=$this->title ?></h3>
           
        </div>

        <div class="box-body">


            <div class="table-responsive">
                <?=
                GridView::widget([
                    'layout'           => '{items}{summary}{pager}',
                    'dataProvider'     => $dataProvider,
                    'pager'            => [
                        'class'          => yii\widgets\LinkPager::className(),
                        'firstPageLabel' => 'First',
                        'lastPageLabel'  => 'Last'],
                    'filterModel'      => $searchModel,
                    'tableOptions'     => ['class' => 'table table-striped table-bordered table-hover'],
                    'headerRowOptions' => ['class' => 'x'],
                    'columns'          => [

                        [
                            'class'         => 'yii\grid\ActionColumn',
                            'template' => '{edit} {view}',
                            'buttonOptions' => ['class' => 'btn btn-default btn-xs'],
                            'contentOptions' => ['nowrap' => 'nowrap'],
                            'buttons' => [
                                'edit'=> function ($url, $model) {
                                    return Html::a('操作', $url, ['class' => 'btn btn-default btn-xs']);
                                }
                            ],
                            'urlCreator'    => function($action, $model, $key, $index) {
                                // using the column name as key, not mapping to 'id' like the standard generator
                                $params    = is_array($key) ? $key : [$model->primaryKey()[0] => (string) $key];
                                $params[0] = \Yii::$app->controller->id ? \Yii::$app->controller->id . '/' . $action : $action;
                                return Url::toRoute($params);
                            },
                        ],
                        'user_id',
                        'value1',
                        'value2',
                        'value3',
                    /* 'password' */
                    ],
                ]);
                ?>
            </div>
        </div>
    </div>
</div>


<?php \yii\widgets\Pjax::end() ?>



